<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:tk="http://www.qdocuments.net" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.qdocuments.net" elementFormDefault="qualified">
  <xs:import schemaLocation="Module.xsd"/>
  <xs:element name="Module">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Title" type="xs:string"/>
        <xs:element ref="tk:DataSet"/>
        <xs:element ref="tk:Extension" minOccurs="0"/>
        <xs:element ref="tk:DisablePage" minOccurs="0"/>
        <xs:element ref="tk:DefaultOrder" minOccurs="0"/>
        <xs:element name="DefaultSortField" type="xs:byte" minOccurs="0"/>
        <xs:element ref="tk:FunctionRight" minOccurs="0"/>
        <xs:element ref="tk:Resolvers"/>
        <xs:element ref="tk:Relations" minOccurs="0"/>
        <xs:element ref="tk:XsltFiles"/>
      </xs:sequence>
      <xs:attribute name="HttpPost" type="xs:boolean"/>
      <xs:attribute name="SupportData" type="xs:boolean"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="DataSet">
    <xs:simpleType>
      <xs:restriction base="xs:NMTOKEN">
        <xs:enumeration value="Single"/>
        <xs:enumeration value="SingleXml"/>
        <xs:enumeration value="SingleDList"/>
        <xs:enumeration value="SingleDListXml"/>
        <xs:enumeration value="List"/>
        <xs:enumeration value="ListXml"/>
        <xs:enumeration value="ListDetail"/>
        <xs:enumeration value="ListDetailXml"/>
        <xs:enumeration value="MasterDetail"/>
        <xs:enumeration value="MasterDetailXml"/>
        <xs:enumeration value="MultipleMasterDetail"/>
        <xs:enumeration value="MultipleMasterDetailXml"/>
        <xs:enumeration value="Multiple"/>
        <xs:enumeration value="MultipleXml"/>
        <xs:enumeration value="MultipleDList"/>
        <xs:enumeration value="MultipleDListXml"/>
        <xs:enumeration value="AllRow"/>
        <xs:enumeration value="AllRowXml"/>
        <xs:enumeration value="Config"/>
        <xs:enumeration value="ConfigXml"/>
        <xs:enumeration value="Detail"/>
        <xs:enumeration value="DetailXml"/>
        <xs:enumeration value="Tree"/>
        <xs:enumeration value="DetailTable"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="Extension">
    <xs:complexType mixed="true">
      <xs:complexContent mixed="true">
        <xs:restriction base="xs:anyType"/>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="DisablePage">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="(Insert|Update|Delete|List|Detail)((\|)(Insert|Update|Delete|List|Detail))*"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="DefaultOrder">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="ASC"/>
        <xs:enumeration value="DESC"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="FunctionRight">
    <xs:complexType>
      <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="tk:SubFunctionRight"/>
      </xs:sequence>
      <xs:attribute name="FunctionKey" type="xs:string" use="required"/>
      <xs:attribute name="FuncType" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="None"/>
            <xs:enumeration value="SubFunction"/>
            <xs:enumeration value="Admin"/>
            <xs:enumeration value="Function"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="SubFunctionRight">
    <xs:complexType>
      <xs:attribute name="PageStyle" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="Detail"/>
            <xs:enumeration value="List"/>
            <xs:enumeration value="Custom"/>
            <xs:enumeration value="Insert"/>
            <xs:enumeration value="Delete"/>
            <xs:enumeration value="Update"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="SubFunctionKey" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Resolvers">
    <xs:complexType>
      <xs:sequence maxOccurs="unbounded">
        <xs:element ref="tk:Resolver"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Resolver">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="RegName" type="xs:string"/>
        <xs:element ref="tk:Xml"/>
        <xs:element ref="tk:DataRight" minOccurs="0"/>
        <xs:element ref="tk:DListRefParams" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="tk:Extension" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="Style" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="FixTable"/>
            <xs:enumeration value="None"/>
            <xs:enumeration value="Table"/>
            <xs:enumeration value="Normal"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="List" type="xs:boolean"/>
      <xs:attribute name="DetailList" type="xs:boolean"/>
      <xs:attribute name="Type">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="View"/>
            <xs:enumeration value="Table"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="Source" type="xs:string"/>
      <xs:attribute name="Main" type="xs:boolean"/>
      <xs:attribute name="Order" type="xs:unsignedInt"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Xml">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:pattern value="(..[/\\])*Data[/\\].*"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
  <xs:element name="DataRight">
    <xs:complexType>
      <xs:attribute name="RightType">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="com"/>
            <xs:enumeration value="user"/>
            <xs:enumeration value="owner"/>
            <xs:enumeration value="ownercom"/>
            <xs:enumeration value="mobile"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="OwnerField" type="xs:string" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="DListRefParams">
    <xs:complexType>
      <xs:attribute name="Name" type="xs:string" use="required"/>
      <xs:attribute name="Value" type="xs:string"/>
      <xs:attribute name="TableName" type="xs:string"/>
      <xs:attribute name="FieldName" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Relations">
    <xs:complexType>
      <xs:sequence maxOccurs="unbounded">
        <xs:element ref="tk:Relation"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Relation">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="MasterResolver" type="xs:string"/>
        <xs:element name="DetailResolver" type="xs:string"/>
        <xs:element name="MasterField" type="xs:string"/>
        <xs:element name="DetailField" type="xs:string"/>
      </xs:sequence>
      <xs:attribute name="Type">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="DetailValue"/>
            <xs:enumeration value="DetailRelation"/>
            <xs:enumeration value="MasterValue"/>
            <xs:enumeration value="MasterRelation"/>
            <xs:enumeration value="OnlyFill"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="XsltFiles">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Insert" type="xs:string"/>
        <xs:element name="Update" type="xs:string"/>
        <xs:element name="Detail" type="xs:string"/>
        <xs:element name="List" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
